﻿// ***********************************************************************
// Assembly         : Invisionware.API.Amazon
// Author           : Shawn Anderson (sanderson@eye-catcher.com)
// Created          : 01-10-2014
//
// Last Modified By : Shawn Anderson
// Last Modified On : 01-19-2014
// ***********************************************************************
// <copyright file="ItemDataTypes.cs" company="Invisionware">
//     Copyright (c) Invisionware. All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************

using System.Collections.Generic;

namespace Invisionware.API.Amazon
{
	/// <summary>
	/// Class AwsItemLookupOptions.
	/// </summary>
	public class AwsItemLookupOptions
	{
		#region Constructors
		/// <summary>
		/// Initializes a new instance of the <see cref="AwsItemLookupOptions"/> class.
		/// </summary>
		public AwsItemLookupOptions()
		{
			//Condition = AwsItemCoditionTypes.All;
			//IncludeReviewsSummary = true;
			IdType = AwsItemIDTypes.ASIN;
		}
		#endregion Constructors

		#region Public Properties
		// One or more (up to ten) positive integers that uniquely identify an item. The meaning of the number is 
		//	specified by IdType. That is, if IdType is ASIN, the ItemId value is an ASIN. If ItemIdis an ASIN, a 
		//	search index cannot be specified in the request.
		// Type: String
		// Default: None
		// Constraints: Must be a valid item ID. For more than one ID, use a comma-separated list of up to ten IDs.
		public string ItemId { get; set; }

		// Type of item identifier used to look up an item. All IdTypes except ASINx require a SearchIndex to be specified.
		// Type: String
		// Default: ASIN
		// Valid Values: SKU | UPC | EAN | ISBN (US only, when search index is Books). UPC is not valid in the CA locale.
		public AwsItemIDTypes? IdType { get; set; }

		// Specifies an item's condition. If Condition is set to “All,” a separate set of responses is returned for each 
		//	valid value of Condition. The default value is "New" (not "All"). So, if your request does not return results, 
		//	consider setting the value to "All." When the value is "New," the ItemSearch Availability parameter cannot be 
		//	set to "Available." Amazon only sells items that are "New."
		// Type: String
		// Default: New
		// Valid Values: Used | Collectible | Refurbished, All 
		/// <summary>
		/// Gets or sets the condition.
		/// </summary>
		/// <value>The condition.</value>
		public AwsItemCoditionTypes? Condition { get; set; }

		// When set to true, returns the reviews summary within the Reviews iframe.
		// Type: Boolean
		// Default: True
		// Valid Values: True | False
		/// <summary>
		/// Gets or sets a value indicating whether [include reviews summary].
		/// </summary>
		/// <value><c>true</c> if [include reviews summary]; otherwise, <c>false</c>.</value>
		public bool? IncludeReviewsSummary { get; set; }

		// Specifies the types of values to return. You can specify multiple response groups in one request by separating 
		//	them with commas.
		// Type: String
		// Default: Small
		// Valid Values: Accessories | BrowseNodes | EditorialReview | Images | ItemAttributes | ItemIds | Large | 
		//				Medium | OfferFull | Offers | PromotionSummary | OfferSummary| RelatedItems | Reviews | 
		//				SalesRank | Similarities | Small | Tracks | VariationImages | Variations (US only) | VariationSummary 
		//
		// Use the BrowseNodes response group to find the browse node of an item.
		// Use the Tracks response group to find the track, title, and number for each track on each CD in the response.
		// Use the Similarities response group to find the ASIN and Title for similar products returned in the response.
		// Use the Reviews response group to find reviews written by customers about an item, and the total number of 
		//	reviews for each item in the response.
		// Use the OfferSummary response group to find the number of offer listings and the lowest price for each of the 
		//	offer listing condition classes, including New, Used, Collectible, and Refurbished.
		// Use the Accessories response group to find the a list of accessory product ASINs and Titles for each product 
		//	in the response that has accessories. 
		/// <summary>
		/// Gets or sets the response group.
		/// </summary>
		/// <value>The response group.</value>
		public AwsItemResponseGroupTypes? ResponseGroup { get; set; }

		// This optional parameter is only valid when the RelatedItems response group is used. Each ItemLookup request 
		//	can return, at most, ten related items. The RelatedItemPage value specifies the set of ten related items to 
		//	return. A value of 2, for example, returns the second set of ten related items 
		/// <summary>
		/// Gets or sets the related item page.
		/// </summary>
		/// <value>The related item page.</value>
		public uint? RelatedItemPage { get; set; }

		// This parameter is required when the RelatedItems response group is used. The type of related item returned 
		//	is specified by the RelationshipType parameter. Sample values include Episode, Season, and Tracks. For a 
		//	complete list of types, go to Relationship Types.
		//	Required when RelatedItems response group is used.
		/// <summary>
		/// Gets or sets the type of the relationship.
		/// </summary>
		/// <value>The type of the relationship.</value>
		public string RelationshipType { get; set; }

		// The product category to search.
		// Type: String
		// Default: None
		// Valid Values: A search index, for example, Apparel, Beauty, Blended, Books, and so forth. For a complete 
		//	of search indices, see Search Indices.
		// Constraint:If ItemIdis an ASIN, a search index cannot be specified in the request. Required for non-ASIN ItemIds.
		/// <summary>
		/// Gets or sets the index of the search.
		/// </summary>
		/// <value>The index of the search.</value>
		public string SearchIndex { get; set; }

		// By default, reviews are truncated to 1000 characters within the Reviews iframe. To specify a different length, 
		//	enter the value. To return complete reviews, specify 0.
		// Type: Integer
		// Default: 1000
		// Constraints: Must be a positive integer or 0 (returns entire review)
		/// <summary>
		/// Gets or sets the truncate reviews at.
		/// </summary>
		/// <value>The truncate reviews at.</value>
		public uint? TruncateReviewsAt { get; set; }

		// Page number of variations returned by ItemLookup. By default, ItemLookup returns all variations. Use VariationPage 
		//	to return a subsection of the response. There are 10 variations per page. To examine offers 11 trough 20, for 
		//	example, set VariationPage to 2.
		// Type: String
		// Default: All
		// Valid Values: Integer between 1 and 150, inclusive 
		/// <summary>
		/// Gets or sets the variation page.
		/// </summary>
		/// <value>The variation page.</value>
		public uint? VariationPage { get; set; }
		#endregion Public Properties

		#region Internal Methods
		/// <summary>
		/// Prepares this instance.
		/// </summary>
		/// <returns>IDictionary{System.StringSystem.String}.</returns>
		internal IDictionary<string, string> Prepare()
		{
			var r1 = new Dictionary<string, string>();

			r1["ItemId"] = ItemId;
			if (IdType.HasValue) r1["IdType"] = IdType.Value.ToString();
			if (Condition.HasValue) r1["Condition"] = Condition.Value.ToString();
			if (IncludeReviewsSummary.HasValue) r1["IncludeReviewsSummary"] = IncludeReviewsSummary.Value.ToString();
			if (ResponseGroup.HasValue) r1["ResponseGroup"] = ResponseGroup.Value.ToString();
			if (RelatedItemPage.HasValue) r1["RelatedItemPage"] = RelatedItemPage.Value.ToString();
			if (!string.IsNullOrEmpty(RelationshipType)) r1["RelationshipType"] = RelationshipType;
			if (!string.IsNullOrEmpty(SearchIndex)) r1["SearchIndex"] = SearchIndex;
			if (TruncateReviewsAt.HasValue) r1["TruncateReviewsAt"] = TruncateReviewsAt.Value.ToString();
			if (VariationPage.HasValue) r1["VariationPage"] = VariationPage.Value.ToString();

			return r1;
		}
		#endregion Internal Methods
	}
}
